<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<form class="form-inline" method="GET" action="<?php echo $this->input->server('REQUEST_URI'); ?>" name="queryForm" id="queryForm">
<input type="hidden" name="c" id="c" value="<?php echo $this->input->get('c') ?>">
<input type="hidden" name="m" id="m" value="<?php echo $this->input->get('m') ?>">
  <div class="form-group">
    <label for="year">所属年份：</label>
    <select class="form-control" id="year" name="year">
      <option value="">请选择</option>
    </select>
  </div>
 <div class="form-group">
  <button type="submit" class="btn btn-default btn-primary">查询</button>
  </div>
</form>
<?php
	$singleFieldList = array(
		'fixedMoney'=>'双月额度',
    'preCarryMoney' => '上双月结转金额',
    'canUseMoney' => '可用额度',
    'budgetApply'=>'预算申请金额',
    'budgetAudit'=>'预算审核金额',
    'settleApply'=>'结算申请金额',
    'settleAudit'=>'结算审核金额',
		'canSettleMoney'=>'可结算金额',
    'storeReach' => '来店目标达成率',
    'standardRate' => '标准动作完成率',
		'score'=>'活动评分系数',
		'settleMoney'=>'结算金额',
		'buBudgetApply'=>'补报预算申请金额',
		'buBudgetAudit' => '补报预算审核金额',
		'buSettleApply' => '补报结算申请金额',
		'buSettleAudit' => '补报结算审核金额',
		'buCanSettleMoney' => '补报可结算金额',
		'buLoseMoney' => '补报扣罚金额',
		'buSettleMoney' => '补报结算金额',
		'finalSettleMoney' => '最终结算金额',
    'carryMoney' => '结转金额',
	);
?>
<div style="margin-top: 10px;">
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php foreach ($timeUnitList as $key => $value) { ?>
        <th class="bg-primary text-center" width="12.5%"><?php echo $value; ?></th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($singleFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($singleFieldList)?>"><h4>单店基金</h4></td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php
        if (isset($singleProcList[$timeK][$filedKey])) {
          //未评分显示文字
          if ($filedKey == 'score') {
            if ((float)$singleProcList[$timeK][$filedKey] == 0) {
              echo '未评分';
            }else{
              echo $singleProcList[$timeK][$filedKey];  
            }
          }elseif(in_array($filedKey, array('storeReach','executionRate','standardRate'))){
            echo round((float)$singleProcList[$timeK][$filedKey], 2)."%";
          }else{
            echo $singleProcList[$timeK][$filedKey];
          }
        }
        ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php }?>
    </tbody>
  </table>
  <?php
  $xunFieldList = array(
    'fixedMoney'=>'双月额度',
    'siteNum' => '站点数',
    'budgetApply'=>'预算申请金额',
    'settleApply'=>'结算申请金额',
    'settleAudit'=>'结算审核金额',
    'settleMoney'=>'结算金额',
  );
  $carFieldList = array(
    'budgetApplyGx' => '广宣预算申请金额',
    'budgetApplyRent' => '场租预算申请金额',
    'budgetApplyMatching' => '配套预算申请金额',
    'budgetApply' => '预算申请总金额',
    'subsidyGx' => '广宣活动补贴',
    'settleApplyGx' => '广宣结算申请金额',
    'canSettleGx' => '广宣可结算金额',
    'settleStoreTotal' => '参展专营店实际出资总额',
    'settleQiTotal'=>'启辰店实际出资总额',
    'settleRmpSupport'=>'RMP支持场租费用',
    //'settleApplyRent' => '场租结算申请金额',
    'subsidyMatching' => '配套额度',
    'settleApplyMatching' => '配套结算申请金额',
    'canSettleMatching' => '配套可结算金额',
    'settleMoney' => '本站结算金额',
    'kpi' => 'KPI系数',
    'finalSettleMoney' => '最终结算金额',
    );
?>
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php foreach ($timeUnitList as $key => $value) { ?>
        <th class="bg-primary text-center" width="12.5%"><?php echo $value; ?></th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($xunFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($xunFieldList)?>"><h4>巡展基金</h4></td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php echo isset($xunProcList[$timeK][$filedKey]) ? $xunProcList[$timeK][$filedKey] : '' ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php }?>
      <?php
        $i = 0;
        foreach ($carFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($carFieldList)?>"><h4>车展基金</h4></td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php echo isset($carProcList[$timeK][$filedKey]) ? $carProcList[$timeK][$filedKey] : '' ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>

<?php
$cityFieldList = array(
          'city' => array(
              'fixedMoney'=>'双月额度',
              //'yearUsedMoney'=>'年度已使用费用',
              'budgetApply'=>'预算申请金额',
              'budgetAudit' => '预算审核金额',
              'settleApply'=>'结算申请金额',
              'settleAudit' => '结算审核金额',
              'settleMoney'=>'双月结算金额',
              'buSettleApply' => '补报结算申请金额',
              'buSettleAudit' => '补报结算审核金额',
              'buCanSettleMoney' => '补报可结算金额',
              'buLoseMoney' => '补报扣罚金额',
              'buSettleMoney' => '补报结算金额',
              'finalSettleMoney' => '最终结算金额',
            ),
    );
    $cityKeyName = array('city'=>'城市提升基金申报');
?>
<div class="panel panel-primary">
  <!-- Default panel contents -->
  <div class="panel-body">
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php foreach ($timeUnitList as $key => $value) { ?>
        <th class="bg-primary text-center" width="12.5%"><?php echo $value; ?></th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
        <?php
        foreach ($cityFieldList as $k => $v) {
        $i = 0;
        ?>
        <?php
        foreach ($v as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($v)?>"><h4><?=$cityKeyName[$k]?></h4></td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php echo isset($cityProcList[$timeK][$filedKey]) ? $cityProcList[$timeK][$filedKey] : '' ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php } }?>
    </tbody>
  </table>
  </div>
</div>

  <?php
  $spreadFieldList = array(
    'yearMoney' => '年度额度',
    'applyMoney'=>'年度申请总金额',
    'auditMoney' => '年度审批总金额',
    'preSubsidyMoney'=>'年初补贴金额',
    'lostMoney'=>'本双月扣罚金额',
    'lostTotalMoney'=>'扣罚总金额',
    'actSubsidyMoney'=>'实际补贴金额',
  );
?>
<div style="margin-top: 10px;">
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php if ($spreadProcList[0]['lostMoney']): ?>
        <?php foreach ($spreadProcList[0]['lostMoney'] as $lostK => $lostV) { ?>
        <th class="bg-primary text-center"><?=$year!=$lostV['year']?$lostV['year'].'年':''?><?=$lostV['timeUnitStr']?></th>
        <?php } ?>
        <?php else: ?>
        <th class="bg-primary text-center" width="75%"><?php echo $spreadProcList[0]['year']; ?>年</th>
        <?php endif ?>
      </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($spreadFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($spreadFieldList)?>"><h4>固定传播基金</h4></td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>
        <?php if (in_array($filedKey, array('lostMoney'))): ?>
            <?php if ($spreadProcList[0]['lostMoney']): ?>
            <?php foreach ($spreadProcList[0]['lostMoney'] as $lostK => $lostV) { ?>
            <td class="text-center"><?=$lostV['lostMoney']?></td>
            <?php } ?>
            <?php else: ?>
            <td class="text-center"></td> 
            <?php endif ?>
        <?php else: ?>
        <td class="text-center" colspan="<?=count((array)$spreadProcList[0]['lostMoney'])?>"><?=$spreadProcList[0][$filedKey]?></td>
        <?php endif ?>
        <?php $i ++;?>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>

  <?php
  $specialFieldList = array(
    'fixedMoney'=>'双月额度',
    //'preCarryMoney' => '上双月结转金额',
    //'canUseMoney'=>'可用额度',
    'budgetApply'=>'预算申请金额',
    'budgetAudit'=>'预算审核金额',
    'settleApply'=>'结算申请金额',
    'settleAudit' => '结算审核金额',
    'canSettleMoney' => '可结算金额',
    'score' => '活动评分系数',
    'settleMoney' => '结算金额',
    'buSettleApply' => '补报结算申请金额',
    'buSettleAudit' => '补报结算审核金额',
    'buCanSettleMoney' => '补报可结算金额',
    'buLoseMoney' => '补报扣罚金额',
    'buSettleMoney' => '补报结算金额',
    'finalSettleMoney' => '最终结算金额',
    //'carryMoney' => '结转金额',
  );
?>
<div style="margin-top: 10px;">
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php foreach ($timeUnitList as $key => $value) { ?>
        <th class="bg-primary text-center" width="12.5%"><?php echo $value; ?></th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($specialFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($specialFieldList)?>">专项单店基金</td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php echo isset($specialProcList[$timeK][$filedKey]) ? $specialProcList[$timeK][$filedKey] : '' ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>
  <?php
  $specityFieldList = array(
    'fixedMoney'=>'双月额度',
    //'preCarryMoney' => '上双月结转金额',
    //'canUseMoney'=>'可用额度',
    'budgetApply'=>'预算申请金额',
    'budgetAudit'=>'预算审核金额',
    'settleApply'=>'结算申请金额',
    'settleAudit' => '结算审核金额',
    'canSettleMoney' => '可结算金额',
    'score' => '活动评分系数',
    'settleMoney' => '结算金额',
    'buSettleApply' => '补报结算申请金额',
    'buSettleAudit' => '补报结算审核金额',
    'buCanSettleMoney' => '补报可结算金额',
    'buLoseMoney' => '补报扣罚金额',
    'buSettleMoney' => '补报结算金额',
    'finalSettleMoney' => '最终结算金额',
    //'carryMoney' => '结转金额',
  );
?>
<div style="margin-top: 10px;">
  <table class="table table-bordered table-condensed mb27">
    <thead class="text-center">
      <tr>
        <th class="bg-primary text-center" width="12.5%">基金类型</th>
        <th class="bg-primary text-center" width="12.5%">费用流程</th>
        <?php foreach ($timeUnitList as $key => $value) { ?>
        <th class="bg-primary text-center" width="12.5%"><?php echo $value; ?></th>
        <?php } ?>
      </tr>
    </thead>
    <tbody>
        <?php
        $i = 0;
        foreach ($specityFieldList as $filedKey => $filedName) {
        ?>
      <tr>
        <?php if($i==0){?><td class="text-center" rowspan="<?=count($specityFieldList)?>">专项城市基金</td><?php }?>
        <td class="text-center"><?php echo $filedName;?></td>

        <?php foreach ($timeUnitList as $timeK => $timeV) { ?>
        <td class="text-center"><?php echo isset($specityProcList[$timeK][$filedKey]) ? $specityProcList[$timeK][$filedKey] : '' ?></td>
        <?php
        $i ++;
        } ?>
      </tr>
      <?php }?>
    </tbody>
  </table>
</div>
<script type="text/javascript">
  $(function(){
    loadYearList('year',<?=$year?>);
  });
</script>
<?php $this->load->view('common/foot');?>